/*
	Copyright (C) 2010 Salil Bhagurkar

	This file is part of k3

	k3 is free software: you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	k3 is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with k3.  If not, see <http://www.gnu.org/licenses/>.
*/

/*Simply display the exception and halt. */

#include <shared.h>

void exception(char *string)
{
	printk("\nFatal exception occurred : (%s)\n",string);
	asm volatile ("sti");
	while(1);
}

void _ex0(void)
{
	exception("Division by zero");
}

void _ex1(void)
{
	exception("Debug exception");
}

void _ex2(void)
{
	exception("Non maskable Interrupt");
}

void _ex3(void)
{
	exception("Breakpoint");
}

void _ex4(void)
{
	exception("INTO overflow");
}

void _ex5(void)
{
	exception("Out of Bounds exception");
}

void _ex6(void)
{
	exception("Invalid opcodes");
}

void _ex7(void)
{
	exception("No coprocessor");
}

void _ex8(void)
{
	exception("Double fault");
}

void _ex9(void)
{
	exception("Coprocessor segment overrun");
}

void _ex10(void)
{
	exception("Bad TSS");
}

void _ex11(void)
{
	exception("Segment not present");
}

void _ex12(void)
{
	exception("Stack fault");
}

void _ex13(void)
{
	exception("General protection fault");
}

void _ex14(void)
{
	exception("Page fault");
}

void _ex15(void)
{
	exception("Unknown interrupt exception");
}

void _ex16(void)
{
	exception("Coprocessor fault");
}

void _ex17(void)
{
	exception("Alignment check");
}

void _ex18(void)
{
	exception("Machine check");
}
